<?php 
class CBaseBlog extends CBaseEosSingular {

	protected $m_intId;
	protected $m_intCatlogId;
	protected $m_strTitle;
	protected $m_strDescription;
	protected $m_strThumbnail;
	protected $m_strViewCount;
	protected $m_boolIsActive;
	protected $m_strCreatedBy;
	protected $m_strCreatedOn;
	
	public function __construct() {		
		parent::__construct();
		return true;
	}
	
	public function assign( $mixArr ) {		
		
	}
	
	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/
	
	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	
	public function setCatlogId( $intCatlogId ) {
		$this->m_intCatlogId = $intCatlogId;
	}
		
	public function setTitle( $strTitle ) {
		$this->m_strTitle = $strTitle;
	}
	
	public function setDescription( $strDescription ) {
		$this->m_strDescription = $strDescription;
	}
	
	public function setThumbnail( $strThumbnail ) {
		$this->m_strThumbnail = $strThumbnail;
	}
	
	public function setIsActive( $boolIsActive ) {
		$this->m_boolIsActive = $boolIsActive;
	}
	
	public function setViewCount( $strViewCount ) {
		$this->m_strViewCount = $strViewCount;
	}
	
	public function setCreatedBy( $strCreatedBy ) {
		$this->m_strCreatedBy = $strCreatedBy;
	}
	
	public function setCreatedOn( $strCreatedOn ) {
		$this->m_strCreatedOn = $strCreatedOn;
	}
	
	
	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/
	
	public function getId( ) {
		return $this->m_intId;
	}
	public function getCatlogId( ) {
		return $this->m_intCatlogId;
	}
	
	public function getTitle() {
		return $this->m_strTitle;
	}
	
	public function getDescription() {
		return $this->m_strDescription;
	}
	
	public function getThumbnail() {
		return $this->m_strThumbnail;
	}
	
	public function getIsActive() {
		return $this->m_boolIsActive;
	}
	
	public function getViewCount() {
		return $this->m_strViewCount;
	}
	
	public function getCreatedBy() {
		return $this->m_strCreatedBy;
	}
	
	public function getCreatedOn() {
		return $this->m_strCreatedOn;
	}
	

	/**************************************
	************* DATABASE FUNCTIONS ***********
	**************************************/
	
	public function insert( $objDatabase ) {
		$strSql  = ' INSERT INTO `blogs` (`catlog_id`, `title`, `description`, `thumbnail`, `view_count` , `is_active`, `created_by`, `created_on`)';
		$strSql .= ' VALUES ( \'' . $this->getCatlogId() . '\',';
		$strSql .= ' \'' . $this->getTitle() . '\',';
		$strSql .= ' \'' . $this->getDescription() . '\',';
		$strSql .= ' \'' . $this->getThumbnail() . '\',';
		$strSql .= ' \'' . $this->getViewCount() . '\',';
		$strSql .= ' \'' . $this->getIsActive() . '\',';
		$strSql .= ' \'' . $this->getCreatedBy() . '\',';
		$strSql .= ' \'' . $this->getCreatedOn() . '\');';

		parent::insertRecord( $strSql, $objDatabase );
	}
	
	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `blogs` SET ';
		$strSql .= ' `catlog_id` = \'' . $this->getCatlogId() . '\',';
		$strSql .= ' `title` = \'' . $this->getTitle() . '\',';
		$strSql .= ' `description` =  \'' . $this->getDescription() . '\',';
		$strSql .= ' `thumbnail` = \'' . $this->getThumbnail() . '\',';
		$strSql .= ' `view_count` = \'' . $this->getViewCount() . '\',';
		$strSql .= ' `is_active` = \'' . $this->getIsActive() . '\',';
		$strSql .= ' `created_by` = \'' . $this->getCreatedBy() . '\',';
		$strSql .= ' `created_on` = \'' . $this->getCreatedOn() . '\'';
		$strSql .= ' WHERE `id` = \'' . $this->getId() . '\';';
	
		return parent::updateRecord( $strSql, $objDatabase );
	}
	
	public function delete( $objDatabase ) {
	
		$strSql = ' DELETE FROM `blogs` WHERE `id` = ' . $this->getId();
		return parent::deleteRecord( $strSql, $objDatabase );
	}
	
}

?>